<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>水费充值记录</title>
  </head>
  <body>
    <script type="text/javascript">
      Ext.onReady(function(){
        Ext.QuickTips.init();
        Ext.BLANK_IMAGE_URL = '/javascripts/ext/resources/images/default/s.gif';
        //设置对话框最大宽度
        Ext.Msg.getDialog().setWidth(300);
        var houseId = new Ext.form.Hidden({
          name: 'house_id',
          value: '<%=@houseId%>'
        });

        var amount =  new Ext.form.NumberField({
          fieldLabel: '要充值金额',
          allowBlank: false,
          name: 'amount',
          allowDecimals: false,
          allowNegative: false,
          anchor: '90%'
        });

        //提交按钮
        var addWaterRechargeButton = new Ext.Button({
          text: '提交',
          iconCls: 'icon-save',
          handler: function(){
            addWaterRechargeButton.setDisabled(true);
            if (newWaterRechargeRecordFormPanel.form.isValid()) {
              
              newWaterRechargeRecordFormPanel.form.submit({
                success: function(result, resp){
                  if (resp.result.info.indexOf("成功") >= 0) {
                    newWaterRechargeRecordWin.destroy();
                  } else {
                    Ext.MessageBox.alert('消息', resp.result.info);
                    addWaterRechargeButton.enable();
                  }
                },
                failure: function(result, request){
                  addWaterRechargeButton.enable();
                  Ext.MessageBox.alert('消息', '服务器的通信失败!');
                }
              });
            }
            else {
              addWaterRechargeButton.enable();
              //Ext.MessageBox.alert('输入验证有错', '请输入必输选项');
            }
          }
        })
        var newWaterRechargeRecordFormPanel = new Ext.form.FormPanel({
          //baseCls: 'x-plain',
          labelWidth: 65,
          width: '200',
          labelAlign: 'right',
          frame : true,
          url: '/fee/createWaterRechargeRecord',
          items: [amount,houseId],
          buttons: [addWaterRechargeButton,{
              text: '关闭',
              iconCls: 'exit',
              handler: function(){
                newWaterRechargeRecordWin.destroy();
              }
            }]
        });
        newWaterRechargeRecordFormPanel.render('new_water_recharge_form');
      })
    </script>
    <div id="new_water_recharge_form"></div>
  </body>
</html>
